package GUITOOl;

import Entity.User;

import javax.swing.*;
import java.util.ArrayList;

/**
 * The type Friend list model.
 *
 * @author wyc, zry
 * @version 1.0
 */
public class FriListModel extends AbstractListModel {
    /**
     * The friends' array.
     */
    ArrayList<User> uArray;

    /**
     * Instantiates a new Fri list model.
     *
     * @param uArray the u array
     */
    public FriListModel(ArrayList<User> uArray){
        this.uArray=uArray;
    }

    /**
     * get the size of uArray
     * @return uArray's size
     */
    @Override
    public int getSize() {
        return uArray.size();
    }

    /**
     * To get the specific friend
     * @param index the index of friend in the uArray
     * @return friend
     */
    @Override
    public Object getElementAt(int index) {
        return  uArray.get(index) ;
    }
}
